function sleep (millis) {
    var start = new Date().getTime();
    while (true) {
        if (new Date().getTime() - start > millis) {
            break;
        }
    }
}


